Import into current background System Tms Rmn `D|D| Tms Rmn `D|D| Tms Rmn `D|D| Tms Rmn `D|D| System Tms Rmn `D|D| Courier `D|D| enterbook sizetopage Tms Rmn `D|D| Tms Rmn `D|D| `D|D| enterbook enterbook sizetopage ;Ishowhotwords @lengthlist filename import --Joseph Brick. November 90. -- Put your -- When prompts a list p, type the names recordfields on current /separated Hcommas. -- Be sure Zthem Rorder that they appear mfile. asks pgive ASCII xa toolbook -- The delimeter can be either a 4reclist,filename,successcount,linecount,recordcount,stripquotes,\ filetype,lengthlist,linetot -- Get existence ("Enter "(Must be a = "no such exists." X"tbkfile.dll" \getfilesize( listed should correspond fthose data (Example: company,city,state):"\ = "Cancel" user accepted defaults usingdefaults -- test recordFields specified are on evaltest "There && "named" && & "." -- store "Choose f"Delimited" "Fixed" -- don't lengths umber each ("RecordField "& & "."& occupies on & "," -- Give choice "Remove quotation marks values?" f"Yes" = "No" -- Initialize counts lines aren't blank; actually imported; -- charsRead Vthus far read -- temp holds -- maxbuffer maximum will )once. %low %high %memory 1allow. following loop executes Thave been dealt amount remaining -- track charsToRead anything leftover -- (i.e., split up a -- This parses individual & empty does xcontain a full ) > 0 -- find carriage point fline, crLoc parseline = charsread happens -- Send be parsed. Since becomes equal -- loops terminate. Stripchars removes -- marker, stripchars( (26), -- a single inner broken -- so outer fileRead some more. importSummary handler takes one fills T's, matches the x, inform ) <> U" && && " " && given." \ f"Continue" importsummary holder chose (34), jives flenghts ) < ( U" && && " " &&\ total"\ Tindicated." fine; charstart stripspaces( gives a status report "Imported" && && " " && " && & "." every instance source leading trailing <> " " tonup parseline buttonup importSummary stripchars stripspaces buttonup Enter ASCII filename. (Must be a comma-delimited or fixed-field file): cancel no such file No such file exists. tbkfile.dll getfilesize getfilesize tbkfile.dll Enter list of recordfield names separated by commas in order of the data in the file (Example: company,city,state): reclist Cancel reclist evaltest There is no recordfield on the current background named Cancel reclist Choose the ASCII file type: Delimited Fixed Cancel Cancel fixed lengthlist RecordField Enter the number of characters it occupies on each line of the file. lengthlist Cancel lengthlist Remove quotation marks from field values? parseline charsread stripchars parseline ximportSummary fline crLoc charsToRead maxbuffer charsRead usingdefaults filesize reclist filename successcount linecount recordcount stripquotes filetype lengthlist linetot parseline stripchars stripchars delimited Field count of line does not match recordfield list given. Continue Cancel Cancel ximportsummary y5newpage stripchars The length of line of file does not match total characters indicated. Continue Cancel Cancel !import y5newpage stripspaces charstart summary holder reclist linecount recordcount filename successcount stripquotes filetype lengthlist linetot fline importSummary Imported out of records from linecount filename successcount recordcount stripchars source stripspaces source Begin import 4origcolor "sign" info buttondown buttonup buttondown 60,50,100 origcolor buttonup origcolor AAAA: ToolBook always creates a brand new background when you use its native Import command. The scripts in the button on this background allow you to import values into any number of recordFields on the current background from ASCII delimited or fixed-field files. When you click the button labeled "Begin Import," you will be prompted for an ASCII delimited or ASCII fixed-field file name. After entering the filename, you will be prompted for a list of recordField names. Try it out in this book by listing the recordFields "A" through "C." The files packaged with this book, ASCII.DEL and ASCII.FIX, are examples of the delimited and fixed-field file types. They each contain data for three fields. To import ASCII delimited or fixed-field files into the background of your choice, simply copy the button labeled "Begin Import" to your background. nd. asciihelp buttonup buttonup asciihelp fixedhelp buttonup buttonup fixedhelp delfile buttonup buttonup delfile fixedfile buttonup buttonup fixedfile asciihelp fixedhelp delfile fixedfile info buttonup buttonup fixedfile delfile fixedhelp asciihelp Importing ASCII delimited or fixed-field data into the current background.ckground. fixedhelp In ASCII fixed-field files, the number of characters in each data field determines where one data field ends and another begins. This number is constant for each data field for each line of the file. Below is a sample from a fixed-field file. Notice that the data field "name" always occupies the first 20 characters of each line, followed by "date" which occupies characters 21 to 28 of each line, and so on. Tom Jones 10/10/45Accounting Ed Poe 03/23/54M.I.S. The file called ASCII.FIX that comes with this book contains three data fields: the first occupies the first 20 characters of each line, the second takes up the next 8, and the third occupies the remaining 24 characters.24 characters. characters. buttonup buttonup asciihelp ASCII delimited refers to a standard file format in which the recordFields for each ToolBook page (or fields for each database record) occupy a single line in the file. The values on each line are separated by commas and are sometimes surrounded by quotation marks. Such files are created by ToolBook's Export command when "delimited" is specified. Below is a sample of an ASCII delimited file representing the data fields "name," "birthdate", and "department." "Tom Jones","10/10/45","Accounting" "Ed Poe","03/23/54","M.I.S." The file ASCII.DEL that comes with this package contains three comma-delimited data fields. buttonup buttonup delfile "Ann Tyler",06/23/39,"Shipping" "Barbara Bush",04/04/23,"Operations" "Ginger Grant",03/05/45,"Sales" "Jerry Mathers",04/02/90,"Telesales" "Joe Petroni",12/04/38,"Aviation Mechanics" "John Lydon",03/06/61,"Technical Support" "Keith Partridge",08/04/53,"Technical Support" "Marsha Brady",07/07/64,"Development" "Martha Ray",09/30/31,"Operations" "Nina Hagen",03/04/56,"Marketing" "Sean Cassidy",08/03/45,"Sales" "Shaft",01/31/71,"Security" "Thurston Howell, III",09/23/45,"Finance" "Tony Dow",05/06/40,"Shipping" buttonup buttonup fixedfile Ann Tyler 06/23/39Shipping Barbara Bush 04/04/23Operations Ginger Grant 03/05/45Sales Jerry Mathers 04/02/90Telesales Joe Petroni 12/04/38Aviation Mechanics John Lydon 03/06/61Technical Support Keith Partridge 08/04/53Technical Support Marsha Brady 07/07/64Development Martha Ray 09/30/31Operations Nina Hagen 03/04/56Marketing Sean Cassidy 08/03/45Sales Shaft 01/31/71Security Thurston Howell, III09/23/45Finance Tony Dow 05/06/40Shipping buttonup buttonup buttonup buttonup import View script RBreclist 20,8,24, 20,8,24, "Do you want delete "Yes" buttonup buttonup Do you want to delete all pages from the background? clear Delete pages a,b,c B h@@